<template>
  <el-progress
    type="circle"
    :percentage="percentage"
  >
    <template #default="{ percentage }">
      <span class="percentage-value">{{ percentage }}%</span>
    </template>
  </el-progress>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  name: 'ProgressNode',
  inject: ['getNode'],
  data () {
    return {
      percentage: 80
    }
  },
  mounted () {
    const node = this.getNode()
    node.on('change:data', ({ current }) => {
      const { progress } = current
      this.percentage = progress
    })
  }
})
</script>
<style lang="scss" scoped>
  .el-progress{
    width: 100%;
    height: 100%;
    :deep(.el-progress-circle){
      width: 100% !important;
      height: 100% !important;
    }
  }
</style>
